const fs = require('fs');
const path = require('path');

module.exports = {
    videos
};

function videos(meetingFolder) {
    let folder = path.resolve(meetingFolder, 'video');
    return getfiles(folder, (file) => file.lastIndexOf('.webm'));
}


function getfiles(folder, filter) {
    try {
        let dirs = fs.readdirSync(folder);
        return dirs.filter(filter).map((file) => path.join(folder, file));
    } catch (e) {
        return [];
    }
}